import { Injectable } from '@angular/core';

@Injectable({
    providedIn: 'root'
})
export class TimeService {

    static getNowDate(): string {
        const date = new Date();
        let month: string | number = date.getMonth() + 1;
        let strDate: string | number = date.getDate();

        if (month <= 9) {
            month = "0" + month;
        }

        if (strDate <= 9) {
            strDate = "0" + strDate;
        }

        return date.getFullYear() + "-" + month + "-" + strDate + " " + date.getHours()
            + ":" + date.getMinutes() + ":" + date.getSeconds();
    }
    constructor() { }
}